<?php
$this->breadcrumbs=array(
	'Banner Masters'=>array('admin'),
	'Manage',
);

$this->menu=array(
	array('label'=>'Manage Banners','url'=>array('admin')),
	array('label'=>'Create Banner','url'=>array('create')),
	array('label'=>'RHS Banner','url'=>array('adminrhs')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('banner-master-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h3>Manage Banner Masters</h3>


<?php // echo CHtml::link('Advanced Search','#',array('class'=>'search-button btn')); ?>
<div class="search-form" style="display:none">
<?php 
// $this->renderPartial('_search',array(
	// 'model'=>$model,
// )); ?>
</div><!-- search-form -->

<?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'banner-master-grid',
	'dataProvider'=>$model->search(),
	'type'=>'striped bordered condensed hover',
	'filter'=>$model,
	'columns'=>array(
		//'banner_id',
		
		//'page_id',
		array(
		'name'=>'page_id',
		'value'=>'PageMaster::model()->getModel("PAGE-ID-NAME",array("page_id"=>$data->page_id))'
		),
		//'banner_position',
		array(
		'name'=>'banner_position',
		'value'=>'PageMaster::model()->getModel("LOC-ID-NAME",array("mapping_id"=>$data->banner_position))'
		),
		/*array(
			'name'=>'start_date',
			'value'=>'ApplicationConfig::app()->getFormattedDate($data->start_date)',
			'filter'=>false,
		),
		array(
			'name'=>'end_date',
			'value'=>'ApplicationConfig::app()->getFormattedDate($data->end_date)',
			'filter'=>false,
		),*/
		'type',
		array(
			'header' => 'image/widget/code',
		 	'type'  => 'raw',
			'value'=>'BannerMaster::model()->getContent(array("type"=>$data->type,"image"=>$data->image,"widget"=>$data->widget_name,"code"=>$data->banner_code));',
		 	//'htmlOptions' => array("style" => "width: 50px;height:40px;","align"=>"center"),
		 	'filter'=>false,
         ),
		//'banner_code',
		//'image',
		/*array(
            'name' => 'image',
		 	'type'  => 'raw',
			'value'=>'($data->image!="")? CHtml::image(Yii::app()->baseUrl."/uploads/banner/small/".$data->image,"",array("style" => "width: 50px;height:40px;","align"=>"center")) : ""',
		 	'htmlOptions' => array("style" => "width: 50px;height:40px;","align"=>"center"),
		 	'filter'=>false,
         ),*/
		//'active',
		'page_url',
		array(
		'name'=>'active',
		'value'=>'($data->active==1)?"Active":"Inactive"',
		'filter'=>false,
		),	
		//'created_by',
		//'created_date',
		//'edited_by',
		//'edited_date',
		
		
		array(
			'class'=>'bootstrap.widgets.TbButtonColumn',
			'template'=>'{update}{delete}',
		),
	),
)); ?>
